package com.gx.mxbbx.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gx.mxbbx.dao.RuralMapper;
import com.gx.mxbbx.po.Rural;
import com.gx.mxbbx.service.RuralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service
@Transactional
public class RuralServiceImpl implements RuralService {
    @Autowired
    private RuralMapper ruralMapper;

    public PageInfo<Rural> getruralList(String countyId, String peasantId, String fullName, Integer currentPage, Integer limit) {
        PageHelper.startPage(currentPage, limit);
        List<Rural> list = ruralMapper.getruralList(countyId, peasantId, fullName);
        PageInfo<Rural> pageInfo = new PageInfo<Rural>(list);
        return pageInfo;
    }

    public Rural rurallook(Integer id) {
        Rural rural = ruralMapper.rurallook(id);
        return rural;
    }

    public void ruraladd(Rural rural) {
        ruralMapper.ruraladd(rural);
    }

    public Rural ruralopenEdit(Integer id) {
        Rural rural = ruralMapper.ruralopenEdit(id);
        return rural;
    }

    public void ruraledit(Rural rural) {
        ruralMapper.ruraledit(rural);
    }

    public void ruraldelete(Integer id) {
        ruralMapper.ruraldelete(id);
    }
}
